#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
using namespace std;

namespace zy
{
	template<class Iterator,class Ref,class Ptr>
	struct ReverseIterator
	{
		typedef ReverseIterator<Iterator, Ref, Ptr> Self;

		Iterator _it;

		ReverseIterator(Iterator t)
			:_it(t)
		{}
		Ref operator*()
		{
			Iterator tmp(_it);
			tmp--;
			return *tmp;
		}
		Ptr operator->()
		{
			//return _it.operator->();
			return &(operator*());
		}
		bool operator!=(const Self& x)
		{
			return _it != x._it;
		}
		Self& operator++()
		{
			return --_it;
		}
		Self operator++(int)
		{
			Self tmp(_it);
			--_it;
			return tmp;
		}
		Self& operator--()
		{
			return ++_it;
		}
		Self operator--(int)
		{
			Self tmp(_it);
			++_it;
			return tmp;
		}
	};
}

